package arch.chameleon.busi.sample.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import arch.chameleon.busi.sample.model.SampleCpu;
import arch.chameleon.busi.sample.model.SampleInfo;

/**
 * sampleCpu实体数据操作
 * @author George
 *
 */
public interface SampleCpuDao extends CrudRepository<SampleCpu, String> {
	
	/**
	 * 实体联合查询
	 * @return
	 */
	@Query(
			"select new arch.chameleon.busi.sample.model.SampleInfo" + 
			"(sc.id, sc.specId, sc.name, sc.price, scs.core, scs.frequency)" + 
			" from SampleCpu sc, SampleCpuSpec scs where sc.specId = scs.id"
	)
	List<SampleInfo> findAllSampleInfo();
}
